<div class="row"><h3 class="page-header">用户组管理<small>/<gt name='info.id' value='0'>修改<else/>添加</gt>用户组</small></h3></div>
<div class="row">
	<div class="panel panel-default">
		<div class="panel-body">
			<form role="form" id="myform" method="post"  class="form-horizontal">
			    <div class="form-group">
			        <label class="col-sm-3 control-label">用户组名称：<span class="c-red">*</span></label>
			        <div class="col-sm-4 input-group">
			        	<input class="form-control required" name="name" value="{$info.name}" maxlength='10'>
			        </div>
			    </div>
		       	<div class="form-group">
		           <label class="col-sm-3 control-label">用户组备注：</label>
		           <div class="col-sm-4 input-group">
		           		<textarea rows="2" class="form-control" name="remark" maxlength='20'>{$info.remark}</textarea>
		           </div>
		        </div>
		        <div class="form-group">
	                <label class="col-sm-3 control-label">用户组权限：</label>
	                <div class="col-sm-4 input-group">
	                	<volist name='list' id='list'>
                			<switch name='list.num'>
                                <case value='3'><assign name='str' value='|&nbsp;&nbsp;|&nbsp;&nbsp;|-&nbsp;'/></case>
                                <case value='2'><assign name='str' value='|&nbsp;&nbsp;|-&nbsp;'/></case>
                                <default/><assign name='str' value='|-&nbsp;'/>
                            </switch>
			                <div class="checkbox"><label><input data-id='{$list.id}' class="node{$list.pid}" type="checkbox" name="rules[]" <?php if(in_array($list["id"], $info["rules"])){echo 'checked';}?> value="{$list.id}">{$str}{$list.title}</label></div>
						</volist>
		            </div>
	            </div>
		        <input type='hidden' name='id' id="id" value='{$info.id}'>
		        <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-5">
				        <button class="btn btn-default checkAll" type="button">全选</button>
				        <button class="btn btn-primary" type="submit">提交</button>
				       	<a href="{:U('Group/index')}"><button class=" btn btn-default" type="button">返回</button></a>
		       		</div>
		       	</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
/*
$('input[type="checkbox"]').click(function(){
	$('.node' + $(this).data('id')).find('input[type="checkbox"]').attr('checked', $(this).is(':checked'));
	$('.nodes' + $(this).data('pid')).find('input[type="checkbox"]').attr('checked', true);
});*/
$('input[type="checkbox"]').click(function(){
	var id = $(this).data('id'), checked = $(this).is(':checked');
	$('.node' + id).attr('checked', checked);
	$('.node' + id).each(function(i, v){
		$('.node' + $(v).data('id')).attr('checked', checked);
	});
});
$('.checkAll').click(function(){
	$('input[type="checkbox"]').attr('checked', $('input[type="checkbox"]').is(':checked') ? false : true);
});
</script>